<template>

	<body>
		<div class="loan_nav">
			<ul>
				<li>
					<a href="javascript:history.go(-1)">
						<i class="iconfont">&#xe61e;</i>
					</a>
				</li>
				<li>
					<p>申贷记录</p>
				</li>
				<li></li>
			</ul>
		</div>
		<div class="interval_T">

		</div>
		<div>
			<swiper :list="imgList" :show-dots="false" loop auto :aspect-ratio="0.3" dots-position="center" dots-class="custom-bottom"></swiper>
		</div>
		<div class="N_record" v-for="l in list">
			<ul>
				<li>
					<img v-if="l.mainImg" :src="l.mainImg" width="100%">
					<img v-else src="@/assets/img/produceI-01.png" width="100%">
				</li>
				<li>
					<ul>
						<li>
							<p>贷款金额：{{l.loansInterval}}</p>
						</li>
						<li>
							<p>贷款类型：{{l.loansType}}</p>
						</li>
					</ul>
					<ul>
						<li>
							<p>贷款时间：{{l.createDate}}</p>
						</li>
						<li>
							<router-link v-if="l.status == 100" :to="`/releaseevaluation/${l.loansApplyId}`">
							<p class="col-r1">评价</p>
							</router-link>
						</li>
					</ul>
					<ul>
						<li>
							<p>进度情况：
								<router-link :to="`/detailedinquiry/${l.loansApplyId}`">
									<!-- <span class="col_progress">{{statusText(l.status)}}</span> -->
									<span class="col_progress">{{changeStatus(l.status)}}</span>
								</router-link>
							</p>
						</li>
						<li></li>
					</ul>
				</li>
			</ul>
		</div>
		<div class="btn">
			<input @click="query" type="button" :value="loadText" class="col_more" />
		</div>
		<div style="height:1.2rem;">

		</div>
	</body>
</template>

<script>
export default {
	data() {
		return {
			params: {
				page: 1,
				limit: 10,
				sidx: 'create_date',
				order: 'desc'
			},
			list: [],
			loading: false,
			more: true,

			imgList: []
		}
	},
	computed: {
		loadText() {
			if (this.more) {
				if (this.loading)
					return '正在加载...'
				else
					return '点击加载更多'
			} else {
				return '没有更多数据'
			}
		}
	},
	created() {
		this.query()
		this.queryImg()
	},
	methods: {	  
		changeStatus(status) { 
			switch (Number(status)) {
				case 1:
					return "提交申请"
				case 3:
					return "抵押派单贷"
				case 4:
					return "邀约面谈"
				case 5:
					return "签约"
				case 6:
					return "缴纳定金"
				case 7:
					return "递交材料"
				case 8:
					return "更换产品"
				case 9:
					return "审核通过"	
				case 10:
					return "放款"	
				case 11:
					return "缴纳剩余费用"	
				case 99:
					return "审批失败"	
				case 100:
					return "贷款成功"	
				case 101:
					return "取消申请"	
				case 102:
					return "拒绝申请"									
				default:
					return "其他"
			}
		},
		query() {
			if (!this.more || this.loading) return
			this.loading = true
			this.$http.get('/app/loan/list', {
				params: this.params
			}).then(json => {
				const { code, page } = json
				if (code === 0) {
					const { list } = page
					if (list && list.length > 0) {
						this.list = this.list.concat(list)
					} else {
						this.more = false
					}
					this.params.page++
				}
				this.loading = false
			})
		},
		queryImg() {
			this.$http.get('/app/index/carousel', {
				params: { page: 'creditloanrecord' }
			}).then(json => {
				const { code, carousel } = json
				if (code === 0) {
					carousel.forEach(n => {
						this.imgList.push({
							url: n.url,
							img: n.imgPath
						})
					})
				}
			})
		}
	}
}
</script>

<style>

</style>